package leetcode.leetcode_812;

class Solution {
    public double largestTriangleArea(int[][] points) {
        int n = points.length;
        double ans = 0;
        for (int i = 0;i<n;i++){
            for (int j = i+1;j<n;j++){
                for (int k = j+1;k<n;k++){
                    double x1 = (double)points[i][0]-points[j][0];
                    double x2 = (double)points[i][0]-points[k][0];
                    double y1 = (double)points[i][1]-points[j][1];
                    double y2 = (double)points[i][1]-points[k][1];
                    double area = Math.abs(x1*y2-x2*y1);
                    ans = Math.max(ans,area);
                }
            }
        }
        return ans;
    }
}